
var username ;
if($(".header li>span>a")[0]){
	console.log("还没有登陆呢");
}else{
	var str = $(".header li>span").eq(1).text().replace(/\s/g,"");
	username = str.split(",")[0];
	$.ajax({
		type:"get",
		url:"pageHandle.php?action=showShopcar",
		async:true,
		data:{
			username:username
		},
		success:function(res){
			var obj = $.parseJSON(res);
			var result = obj.result;
			var str;
			result.forEach(function(detil,index){
				console.log(detil);
				str += `<tr>
						<td class="book-img"><img src="`+detil.src+`" alt="" /></td>
						<td class="book-name">`+detil.bookname+`</td>
						<td class="book-num">`+detil.bookNum+`</td>
						<td class="price">`+detil.price+`</td>
						<td><button>付款</button></td>
						<td><button>删除</button></td>
					</tr>`;
			})
			$("table").append(str);
			window.location.href = "shopCar1.php";
		}
	})
}